<style lang="scss" scoped>
    @import "alert.scss";
</style>
<template>
    <div v-if="show">
        <div class="alert-content" @click="closeAlertMethods"></div>
        <div class="alert-content-box">
            <h2>{{title}}</h2>
            <p class="alert-message">{{message}}</p>
            <div>
                <div v-for="(items,index) in buttons" v-bind:key="index" :class="items.className">
                    <button @click="items.press">{{items.text}}</button>
                </div>
            </div>
        </div>
    </div>
</template>
<script type="es6">
    export default {
        props: {
            show: {
                type: Boolean,
                default: false//这样可以指定默认的值
            },
            message:{
                type:String,
                default:'默认弹窗'
            },
            title:{
                type:String,
                default:'默认弹窗标题'
            },
            buttons:{
                type:Array,
                default:[
                    {
                        text:"确定",
                        press:()=> {
                            if(callback() === false) return;
                            this.alert.show = false;
                        },
                        className:"ok"
                    }
                ]
                
            }
        },
        data () {
            return {
                
            }
        },
        mounted(){
        },
        methods:{
            closeAlertMethods(){
                // this.$emit(this.pullMessage.closeAlertMethod,'取消');
            },
            sureAlertMethods(){
                // this.$emit('sureAlertMethod','确定'); //主动触发upup方法，'hehe'为向父组件传递的数据
            }
        }
    }
</script>

